package com.example.mytayunapi.Controller;


import com.example.mytayunapi.Entity.recent_browseInfo;
import com.example.mytayunapi.Service.recent_browseInfoService;
import com.example.mytayunapi.Vo.ProductBrowseInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@CrossOrigin
@RestController
@RequestMapping("recent")
public class recent_browseController {
   @Autowired
    private recent_browseInfoService recent_browse_infoService;

    // http://localhost:8080/recent/getBySchoolDegree
    @GetMapping("/getBySchoolDegree")
    public List<ProductBrowseInfo> getBySchoolDegree(@RequestParam String School_degree) {
        return recent_browse_infoService.findProductBrowseInfoBySchoolDegree(School_degree);
    }

    //http://localhost:8080/recent/add
    @PostMapping("/add")
    public Integer add(@RequestBody recent_browseInfo recent_browseInfo) {
        Integer i =  recent_browse_infoService.recent_browseInfo(recent_browseInfo);
        return i;
    }
}
